package com.hui.platform.falseworkapi.service.base.mail.controller;


import cn.hutool.extra.mail.MailUtil;
import com.hui.platform.falseworkapi.common.security.annotation.SecurityIgnored;
import com.hui.platform.falseworkapi.common.web.annotation.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 邮件相关操作接口
 * @author hui
 */
@RestController
@Api(tags = "邮件管理")
@ApiResult
@RequestMapping("/falsework/mail")
@CrossOrigin
public class MailController {


    /**
     *发送邮件
     * @return 标准结果集
     */
    @ApiOperation(value="发送邮箱")
    @GetMapping(path="/send")
    @SecurityIgnored
    public String testSend(@ApiParam("目标邮箱集合") @RequestParam @NotNull List<String> tos,
                           @ApiParam("主题") @RequestParam @NotBlank String topic,
                           @ApiParam("发送内容") @RequestParam @NotBlank String content){
        return MailUtil.send(tos, topic, content, false);
    }
}
